count occurrences of each character in string python using for loop